
fastlane_version "2.26.1"

default_platform :ios

platform :ios do

  desc "Run unit tests and check library"
  lane :test do
    scan(workspace: "Tabman.xcworkspace", scheme: "Tabman", clean: true)
  end

  desc "Deploy a new version to CocoaPods and GitHub"
  lane :deploy do
    test

    podspec = "Tabman.podspec"
    version = version_get_podspec(path: podspec)

    # Push new Github release
    github_release = set_github_release(
      repository_name: "uias/Tabman",
      api_token: ENV["GITHUB_API_TOKEN"],
      name: version,
      tag_name: version,
      description: "#{version} release.",
      commitish: "main"
    )

    # Push spec
    pod_push(allow_warnings: true, verbose: true)

    slack(
      message: "Tabman v#{version} released!" 
    )
  end
end